####试试买两个苹果
from mul_layer import MulLayer

apple = 100  # 苹果价格
apple_num = 2  # 苹果数量
tax = 1.1  # 消费税

# layer
mul_apple_layer = MulLayer()
mul_tax_layer = MulLayer()

# forward
apple_price = mul_apple_layer.forward(apple, apple_num)  # 先算苹果总价
price = mul_tax_layer.forward(apple_price, tax)  # 在上面的基础上再算总价
print(price)  # 220

# backward
dprice = 1
dapple_price, dtax = mul_tax_layer.backward(dprice)
dapple, dapple_num = mul_apple_layer.backward(dapple_price)

print(dapple_price)  # 1.1
print(dtax)  # 200
print(dapple)  # 2.2
print(dapple_num)  # 110
